
<!DOCTYPE html>
<html>
<head>
    <title>Export</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap-table/src/bootstrap-table.css">
    <link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/examples.css">
    <link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">
    <script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/jquery.min.js"></script>
    <script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap-table/src/bootstrap-table.js"></script>
    <script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap-table/src/extensions/export/bootstrap-table-export.js"></script>
    <script src="http://rawgit.com/hhurz/tableExport.jquery.plugin/master/tableExport.js"></script>
    <script src="http://issues.wenzhixin.net.cn/bootstrap-table/ga.js"></script>
</head>
<body>
    <div class="container">
        <h1>2016-12-17日 KPL活动推广统计</h1>
        <table id="table1" data-show-export="true" data-pagination="true" data-click-to-select="true" data-toolbar="#toolbar" pageSize="100">
            <thead>
            <tr>
            	<th data-field="index" data-formatter="indexFormatter" >序号</th>  
                <th data-field="upId">推广用户ID</th>
                <th data-field="downNum">推广用户人数</th>
            </tr>
            </thead>
        </table>
    </div>
    <div class="container">
     	<h1>2016-12-18日 KPL活动推广统计</h1>
        <table id="table2" data-toggle="true" data-show-export="true" data-pagination="true" data-click-to-select="true" data-toolbar="#toolbar" data-url="data1">
            <thead>
            <tr>
            	<th data-field="index" data-formatter="indexFormatter" >序号</th>  
                <th data-field="upId">推广用户ID</th>
                <th data-field="downNum">推广用户人数</th>
            </tr>
            </thead>
        </table>
    </div>
<script>
    var $table = $('#table');
    $(function (){
        $('#toolbar').find('select').change(function () {
            $table.bootstrapTable('destroy').bootstrapTable({
                exportDataType: $(this).val()
            });
        });
       jsonpp1();
       jsonpp2();
    });
    
    function jsonpp1(){
    	$.ajax({
            url: 'http://event.m.shihou.tv/lion_module_share/user_count_temp?startTime=20161217000000&endTime=20161218000000&themeId=3027',
            type: 'GET',
            async: false,
            dataType: "jsonp",
            jsonp: "callback", //服务端用于接收callback调用的function名的参数(请使用callback或jsonp)
			jsonpCallback: "success_jsonpCallback", //callback的function名称
            data: {'url': encodeURI(encodeURI(location.href.split('#')[0]))},
            success: function (res) {
				$('#table1').bootstrapTable({
				    data: res.result,
				    pagination:false
				});
            },
            faile: function (data) {
                //alert(JSON.stringify(data));
            }
        });
		function success_jsonpCallback(){
		}
    }
    
    function jsonpp2(){
    	$.ajax({
            url: 'http://event.m.shihou.tv/lion_module_share/user_count_temp?startTime=20161218000000&endTime=20161219000000&themeId=3027',
            type: 'GET',
            async: false,
            dataType: "jsonp",
            jsonp: "callback", //服务端用于接收callback调用的function名的参数(请使用callback或jsonp)
			jsonpCallback: "success_jsonpCallback", //callback的function名称
            data: {'url': encodeURI(encodeURI(location.href.split('#')[0]))},
            success: function (res) {
				$('#table2').bootstrapTable({
				   // data: res.result,
				    pagination:false
				});
            },
            faile: function (data) {
                //alert(JSON.stringify(data));
            }
        });
		function success_jsonpCallback(){
		}
    }
     
    function indexFormatter(value, row, index) {  
      	return index+1;  
 	}  
</script>
</body>
</html>